﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKDS.DTO;

namespace QLKDS.DAL
{
    public class BookReportManager
    {
       
        public IList<BookReport> GetBookByStore(int StoreId)
        {
            using (var db = new QLKDSDataContext())
            {
                var queryBook = from d in db.Books
                                join c in db.BookStores on d.Id equals c.BookId
                                join e in db.Stores on c.StoreId equals e.Id
                                where d.Status.Equals(1)
                                where e.Id.Equals(StoreId)
                                where c.Quantity>0
                                select new BookReport { Id = d.Id, Code = d.Code, Name = d.Name, Quanlity=c.Quantity};

                return queryBook.OrderBy(d => d.Code).ToList();
            }

        }

       

  

    }
}
